package view;

import java.util.Calendar;

import javax.swing.JTextArea;

public class TextArea extends JTextArea {
	public TextArea() {
		this.setEditable(false);
		this.setWrapStyleWord(true);
		this.setLineWrap(true);
	}

	public void addText(String user, String message) {
		Calendar cal = Calendar.getInstance();
		this.append("[" + cal.get(Calendar.HOUR_OF_DAY) + ":"
				+ cal.get(Calendar.MINUTE) + ":" + cal.get(Calendar.SECOND)
				+ "] " + user + " | " + message+"\n");
		this.setCaretPosition(this.getCaretPosition() + message.length());
	}
}
